package Demo2;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-12-22
 * Time: 15:21
 */
/* 请在这里填写答案 */

class Tel{
    private String name;
    private String mobilephone;

    public Tel(String name, String mobilephone) throws Exception {
        this.name = name;
        if (mobilephone.matches("[0-9]{11}")){
            this.mobilephone=mobilephone;
        }
        else {
            throw new Exception("手机号码必须是数字，且为11位");
        }
    }

    public String getName() {
        return name;
    }

    public String getMobilephone() {
        return mobilephone;
    }
}
public class Main {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner scan=new Scanner(System.in);
        String name=scan.next();
        String mobilephone=scan.next();
        try{
            Tel tel=new Tel(name,mobilephone);
            System.out.println("姓名："+tel.getName()+",手机号码："+tel.getMobilephone());
        }catch(Exception e){
            System.out.println(e);
        }
    }

}







